package cn.kuick.match8.test5;

import java.util.Scanner;

public class PasswordCracker {
	private String dict = "ABCDEFGHIJKLMNOPQRSTUVWZYZ";
	
	private boolean check(int[] cipherText, int size, char password) {
		for(int i=0; i<size; i++) {
			int ch = cipherText[i] ^ password;
			
			if (!('A' <= ch && ch <= 'Z')) {
				return false;
			}
		}
		
		return true;
	}
	
	public String decode(int[] cipherText, int size, char password) {
		StringBuffer sb = new StringBuffer();
		
		for(int i=0; i<size; i++) {
			int ch = cipherText[i] ^ password;
			sb.append((char)ch);
		}
		
		return sb.toString();
	}
	
	public int[] encode(String text, char password) {
		int size = text.length();
		int[] cipherText = new int[size];
		
		for(int i=0; i<size; i++) {
			int ch = text.charAt(i) ^ password;
			cipherText[i] = ch;
		}
		
		return cipherText;
	}

	public String crack(int[] cipherText, int size) {
		
		StringBuffer sb = new StringBuffer();
		
		for(int i=0; i<dict.length(); i++) {
			char pwd = dict.charAt(i);
			
			if (check(cipherText, size, pwd)) {
				sb.append(pwd);
			}
		}
		
		if (sb.length()>0) {
			System.out.println("All pwd:" + sb.toString());
			return decode(cipherText, size, sb.charAt(sb.length() - 1));
		}
		
		return "Not Found";
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		PasswordCracker cracker = new PasswordCracker();
		
		try {
			int n = scan.nextInt();
			int[] cipherText = new int[n];
			
			for (int i=0; i<n; i++) {
				int m = scan.nextInt();
				cipherText[i] = m;
			}
			
			String result = cracker.crack(cipherText, n);
			System.out.println(result);
		} finally {
			scan.close();
		}
	}
}
